<template>
    <div>
        <van-tabbar v-model="active" active-color="#000" inactive-color="#333">
            <van-tabbar-item v-for="(item,index) in tablist" :to="item.name">
                <span>{{item.title}}</span>
                <template #icon="props">
                    <img :src="props.active ? Url+item.icon2 : Url+item.icon1" />
                </template>
            </van-tabbar-item>
        </van-tabbar>
    </div>
</template>

<script>
    export default {
        name: "",
        data(){
            return {
                tablist:[],
                active:0
            }
        },
        props:{
            name:{
                type:String,
            }
        },
        mounted(){
            this.getTab();
        },
        methods:{
            getTab(){
                var that=this;
                that.request1.post1({
                    url: that.Url + "api/index/getFooter",
                    params: {},
                    success: function (res) {
                        // console.log(res)
                        if (res.data.code == 1) {
                            that.tablist=res.data.data.columns;
                            for(var i=0; i<that.tablist.length; i++){
                                if(that.name==that.tablist[i].name){
                                    that.active=i
                                }
                            }
                        } else {
                            alert(res.data.msg)
                        }
                    },
                    fail: function (error) {
                        alert(error.data.msg)
                    }
                })
            }
        }
    }
</script>

<style scoped>

</style>